package com.maiji.cloud.controller.community;

import com.maiji.cloud.controller.BaseController;
import com.maiji.cloud.entities.community.ComComment;
import com.maiji.cloud.entities.community.ComMsgInfo;
import com.maiji.cloud.request.BaseDataReqDto;
import com.maiji.cloud.request.BaseInputDto;
import com.maiji.cloud.request.IdInputDto;
import com.maiji.cloud.request.community.ComCommentMsgInputDto;
import com.maiji.cloud.response.BaseMetaResDto;
import com.maiji.cloud.response.BaseOutPutDto;
import com.maiji.cloud.response.BaseResDto;
import com.maiji.cloud.response.community.ComCommentOutputDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/community")
@Api(tags = {"社区"})
public class ComCommentController extends BaseController {

    /**
     * 获取动态列表 - 评论统计 - pc
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation("获取动态列表 - 评论统计 - pc")
    @PostMapping("/findAllMsgs")
    public BaseMetaResDto<List<ComMsgInfo>> findAllMsgs (@RequestBody BaseDataReqDto<ComMsgInfo> baseDataReqDto){
        return restTemplate.postForObject(REST_URL_PREFIX_COMMUNITY + "/community/findAllMsgs", baseDataReqDto, BaseMetaResDto.class);
    }

    /**
     * 获取动态的评论列表 - pc
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation("获取动态的评论列表 - pc")
    @PostMapping("/findAllComments")
    public BaseMetaResDto<List<ComComment>> findAllComments (@RequestBody BaseDataReqDto<ComComment> baseDataReqDto){
        return restTemplate.postForObject(REST_URL_PREFIX_COMMUNITY + "/community/findAllComments", baseDataReqDto, BaseMetaResDto.class);
    }

    /**
     * 审核评论 - pc
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation("审核评论 - pc")
    @PostMapping("/readComment")
    public BaseResDto readComment (@RequestBody BaseDataReqDto<List<ComComment>> baseDataReqDto){
        return restTemplate.postForObject(REST_URL_PREFIX_COMMUNITY + "/community/readComment", baseDataReqDto, BaseResDto.class);
    }

    /**
     * 回复动态评论的评论 - pc
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation("回复动态评论的评论 - pc")
    @PostMapping("/commentComment")
    public BaseResDto commentComment (@RequestBody BaseDataReqDto<ComCommentMsgInputDto> baseDataReqDto,
                                    @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken,REST_URL_PREFIX_COMMUNITY + "/community/commentComment", baseDataReqDto, BaseResDto.class);
    }

    /**
     * 回复动态的评论 - pc
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation("回复动态的评论 - pc")
    @PostMapping("/commentReply")
    public BaseResDto commentReply (@RequestBody BaseDataReqDto<ComCommentMsgInputDto> baseDataReqDto,
                                    @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken,REST_URL_PREFIX_COMMUNITY + "/community/commentReply", baseDataReqDto, BaseResDto.class);
    }

    /**
     * 动态评论 - pc
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation("动态评论 - pc")
    @PostMapping("/commentMsg")
    public BaseResDto commentMsg (@RequestBody BaseDataReqDto<ComCommentMsgInputDto> baseDataReqDto,
                                    @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken,REST_URL_PREFIX_COMMUNITY + "/community/commentMsg", baseDataReqDto, BaseResDto.class);
    }

}

